/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.N350;
import queenb.web.inteface.N350Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class N350Store extends N350 implements N350Inf {

    @Override
    public int updateN350By(int pnPN350, int pnFN100, String pvNV351, Date pdND352, Date pdND353, String pvNV354,int pnNN355, int pnFH000, int pnFH200, String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_N350, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPN350),
                    new Param(OracleTypes.INTEGER, pnFN100),
                    new Param(OracleTypes.CHAR, pvNV351),
                    new Param(OracleTypes.DATE, pdND352),
                    new Param(OracleTypes.DATE, pdND353),
                    new Param(OracleTypes.CHAR, pvNV354),
                    new Param(OracleTypes.INTEGER, pnNN355),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, N350.class);
        } catch (SQLException ex) {
            Logger.getLogger(N350Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public List<N350> findN350AllDE(int pnFH000, int pnFH200, int pnPN350, int pnFN100,int pnNN355, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_N350DE, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnPN350),
                    new Param(OracleTypes.INTEGER, pnFN100),
                    new Param(OracleTypes.INTEGER, pnNN355),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.find(dataStatement, N350.class);
        } catch (SQLException ex) {
            Logger.getLogger(N350Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N350Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N350Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
 @Override
    public List<N350> findN350All(int pnFH000, int pnFH200, int pnPN350, int pnFN100,int pnNN355, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_N350, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnPN350),
                    new Param(OracleTypes.INTEGER, pnFN100),
                    new Param(OracleTypes.INTEGER, pnNN355),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.find(dataStatement, N350.class);
        } catch (SQLException ex) {
            Logger.getLogger(N350Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N350Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N350Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int deleteN350(int pnPN350, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_N350, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPN350),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, N350.class);
        } catch (SQLException ex) {
            Logger.getLogger(N350Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
}
